<template>
  <div class="box">
    <div class="top">
      <p class="title">实时游客统计</p>
      <p class="bg"></p>
      <p class="right">
        可预约总量
        <span>99999</span>
        人
      </p>
    </div>
    <div class="number">
      <span v-for="(item, index) in people" :key="index">{{ item }}</span>
    </div>
    <!-- 盒子将来echarts展示图形图标的节点 -->
    <div class="charts" ref="charts">123</div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
let people = ref('215908人')
// 引入echarts组件
import * as echarts from 'echarts'
// 引入水球图插件
import 'echarts-liquidfill'
// 获取echarts节点
let charts = ref<any>()
// 组件挂载完毕
onMounted(() => {
  // 获取echarts类的实例
  let mycharts = echarts.init(charts.value)
  // 设置实例的配置项
  mycharts.setOption({
    title: {
      text: '水球图',
    },
    // x|y轴组件
    // xAxis: {},
    // yAxis: {},
    // 系列:决定你展示什么样的图形图标
    series: {
      type: 'liquidFill',
      data: [
        0.6,
        {
          value: 0.5,
          direction: 'left',
          itemStyle: {
            color: 'red',
          },
        },
        0.4,
        0.3,
      ],
      radius: '85%',
    },
  })
})
</script>

<style scoped lang="scss">
.box {
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  margin-top: 20px;

  .top {
    margin-left: 20px;

    .title {
      color: white;
      font-size: 20px;
      margin-top: 10px;
    }

    .bg {
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
      margin-top: 15px;
    }

    .right {
      float: right;
      color: white;
      font-size: 18px;

      span {
        margin: 0px 5px;
        color: yellowgreen;
      }
    }
  }

  .number {
    padding: 10px;
    margin-top: 30px;
    display: flex;

    span {
      flex: 1;
      height: 40px;
      text-align: center;
      line-height: 40px;
      background: url(../../images/total.png) no-repeat;
      background-size: 100% 100%;
      color: #29fcff;
    }
  }

  .charts {
    margin-top: 10px;
    width: 100%;
    height: 225px;
  }
}
</style>
